cmake_minimum_required(VERSION 3.12)

#JAVA path
#use for JNI headers, if you install by package manager or set path correctly
#this setting can be null
#JAVA路径
#查找JNI相关头文件，如果你通过包管理安装或正确的设置了环境变量
#此处可以留空
SET(JAVA_PATH "" CACHE STRING "Path to your JDK (Not Required)")

#switch if cuda available
#是否使用CUDA
#Caution:
#if you use libtorch version includes cuda
#libtorch will ask you for cuda location
#注意：
#如果你使用了带CUDA版本的Libtorch
#LibTorch会要求你提供CUDA的位置
option(USE_CUDA "Use CUDA?" OFF)

#LibTorch path
#this setting is required. Must provide the correct path, unless you set it in system env
#you can provide the root dir of your libtorch path, or you can provide the path of TorchConfig.cmake
#LibTorch 路径
#该设置不可以留空，必须提供路径,除非在系统中设置了环境变量
#可以提供Libtorch的根目录或者提供 TorchConfig.cmake 文件所在的目录
SET(LIBTORCH_PATH "/usr/libtorch" CACHE STRING "Path to your libtorch")
if (${LIBTORCH_PATH} MATCHES /share/cmake/Torch)
    set(Torch_DIR ${LIBTORCH_PATH})
else()
    set(Torch_DIR ${LIBTORCH_PATH}/share/cmake/Torch)
endif ()

#Caution:
#if you use libtorch version includes cuda
#libtorch will ask you for cuda location
#注意：
#如果你使用了带CUDA版本的Libtorch
#LibTorch会要求你提供CUDA的位置
if (USE_CUDA)
    add_compile_definitions(CUDA_AVAILABLE)
    message(STATUS "set cuda: available")
else ()
    message(STATUS "set cuda: unavailable")
endif ()
